#!/bin/bash
##############################################################################
# CloneWindow.sh
# Script to duplicate a mouse selected window
# So one can show the cloned window on other monitor
# Really useful for slideshows where one extends the desktop
#
# Dependecies (names are based on ArchLinux): x11vnc and gtk-vnc
#
# <2013>  <Gabriel B. Casella> <gbc921 at gmail.com>
# Thanks to: progandy <https://bbs.archlinux.org/profile.php?id=60261>
##############################################################################

# Get the window id from the window selected by the mouse click
windowId=$(xwininfo | grep -Eo -m1 '0x[[:alnum:]]*')

# start VNC session in background to automagically wait server start
# calling client just after everything is loaded
x11vnc -localhost -viewonly -id "$windowId" -q -bg

gvncviewer localhost:0

# vim:set ts=2 sw=2 et:

